$(function (){
    //加载默认隐藏展示页
     $(".show").hide()
    //单击后获取输入内容
    $(".btn").bind("click",function (){
        var text = $(".text").val();
        console.log(text)
        $.ajax({
            type: "post",
            url: "/nlp?action=lexAnalysis",
            data: {
                text: text
            },
            dataType: "json",
            success: function (data){
                var len = data.items.length;
                var htmlStr = "";
                for (var i = 0; i < len; i++) {
                    htmlStr += " <div class=\"bottom_div\">词性：<span class=\"right_span\">" + data.items[i].pos + "</span></div>"
                    htmlStr += "<div class=\"bottom_div\">词汇的字符串：<span class=\"right_span\">" + data.items[i].item + "</span></div>"
                    htmlStr += " <div class=\"bottom_div\">命名实体类型：<span class=\"right_span\">" + data.items[i].ne + "</span></div>"
                }
                //拼接到页面上
                $(".show_result").html(htmlStr);
                console.log("成功")
                console.log(data)

            },
             error : function (err){
              console.log("失败")
             }
        })
        //单击后展示隐藏页面
        $(".show").show()
    })

})



